j3deditor.bin.util
Class BackgroundThread

java.lang.Object
  extended by java.lang.Thread
      extended by j3deditor.bin.util.BackgroundThread
All Implemented Interfaces:
java.lang.Runnable

public class BackgroundThread
extends java.lang.Thread

Executes all tasks added to its task queue sequentially in a low priority "daemon" thread.

Author:
Risto Seene
See Also:
BackgroundTask

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected BackgroundThread()
          Creates an instance of BackgroundThread.
 
Method Summary
static void execute(BackgroundTask task)
          Adds the specified task to the task queue and executes it as soon as possible.
static void executeOnce(BackgroundTask task)
          Adds the specified task to the task queue only if equivalent task can not be found in the queue, and executes it as soon as possible.
 void run()
          Executes sequentially all tasks in the task queue.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BackgroundThread

protected BackgroundThread()
Creates an instance of BackgroundThread.

Method Detail

execute

public static void execute(BackgroundTask task)
Adds the specified task to the task queue and executes it as soon as possible.

Parameters:
task - task to be executed

executeOnce

public static void executeOnce(BackgroundTask task)
Adds the specified task to the task queue only if equivalent task can not be found in the queue, and executes it as soon as possible.

Parameters:
task - task to be executed

run

public void run()
Executes sequentially all tasks in the task queue. Not to be called directly by any application.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread